namespace SV_PCC_MODIFIED_BEFORE_CREATE {
﻿//  Gets the temp path env string (no guarantee it's a valid path).
dwRetVal = GetTempPath(MAX_PATH,          // length of the buffer
	lpTempPathBuffer); // buffer for path 
if (dwRetVal > MAX_PATH || (dwRetVal == 0))
{
	PrintError(TEXT("GetTempPath failed"));
	if (!CloseHandle(hFile))
	{
		PrintError(TEXT("CloseHandle(hFile) failed"));
		return (7);
	}
	return (2);
}
//  Generates a temporary file name. 
uRetVal = GetTempFileName(lpTempPathBuffer, // directory for tmp files
	TEXT("DEMO"),     // temp file name prefix 
	0,                // create unique name 
	szTempFileName);  // buffer for name 
if (uRetVal == 0)
{
	PrintError(TEXT("GetTempFileName failed"));
	if (!CloseHandle(hFile))
	{
		PrintError(TEXT("CloseHandle(hFile) failed"));
		return (7);
	}
	return (3);
}
//  Creates the new file to write to for the upper-case version.
hTempFile = CreateFile((LPTSTR)szTempFileName, // file name 
	GENERIC_WRITE,        // open for write 
	0,                    // do not share 
	NULL,                 // default security 
	CREATE_ALWAYS,        // overwrite existing
	FILE_ATTRIBUTE_TEMPORARY, // temporary storage 
	NULL);                // no template 
if (hTempFile == INVALID_HANDLE_VALUE)
{
	PrintError(TEXT("Second CreateFile failed"));
	if (!CloseHandle(hFile))
	{
		PrintError(TEXT("CloseHandle(hFile) failed"));
		return (7);
	}
	return (4);
}
}}